package com.molin.setTest;

import java.util.Comparator;
import java.util.TreeSet;

public class MyTreeSet4 {
    public static void main(String[] args) {
        TreeSet<String> treeSet = new TreeSet<>(new Comparator<String>() {
            @Override
            public int compare(String o1, String o2) {
                return o1.length() - o2.length();

            }
        });
//        lambda
        TreeSet<String> treeSet1 = new TreeSet<String>((String o1, String o2) -> {
            return o1.length() - o2.length();
        });
        treeSet.add("c");
        treeSet.add("ab");
        treeSet.add("df");
        treeSet.add("qwer");
        System.out.println(treeSet);

    }
}
